TalentSync

AI resume builder and ATS optimizer for job seekers. Tailored resumes, outreach, and interview prep from one profile.

Page routing and navigation

App Router routes and the shared navigation config that drives desktop and mobile chrome.

Repository layout#

The application follows Next.js App Router conventions with a strict file-system-based routing hierarchy under the app directory. Pages are grouped by feature and role, with nested routes for deep links and contextual nav.

  • [dashboard/analysis/[id]/page.tsx](file://frontend/app/dashboard/analysis/[id]/page.tsx#L56-L223)
  • dashboard/pdf-resume/page.tsx

Building blocks#

  • Root layout and providers: Sets global styles, theme fonts, manifest, and wraps children with Providers and LayoutContent.
  • Layout content provider: Hosts Navbar and applies responsive margins and sidebar offset.
  • Navigation library: Centralizes nav items, quick actions, and mobile navigation items.
  • Navbar: Desktop sidebar with collapsible behavior, user section, and quick actions; tablet and mobile menus.
  • Sidebar provider: Global state for sidebar collapse to synchronize layout spacing.
  • Mobile bottom navigation: Bottom tab bar with floating action button and active state handling.
  • Authentication and role-based access: FastAPI cookies, proxy.ts, useSession().

How it fits together#

The routing architecture combines:

  • Static routes for public pages (home, about, account).
  • Nested routes under dashboard for role-specific dashboards and analysis workspaces.
  • Dynamic routes for per-resume analysis ([id]).
  • Protected routes: proxy.ts cookie check plus client useSession() guards.
  • [dashboard/analysis/[id]/page.tsx](file://frontend/app/dashboard/analysis/[id]/page.tsx#L56-L194)
  • navbar.tsx
  • mobile-bottom-nav.tsx
  • lib/session.ts

The navigation library defines:

  • Nav items for primary navigation.
  • Quick actions for authenticated users.
  • Mobile navigation items optimized for bottom tab bar.

The Navbar renders:

  • Collapsible desktop sidebar with active-state highlighting.
  • Quick actions for authenticated users.
  • User section with dashboard and sign-out links.
  • Tablet menu overlay with active highlighting.
  • Mobile bottom navigation integrated via LayoutContent.

Protected routes and authentication-aware routing#

Protected routes are enforced through:

  • Client-side guards in dashboard pages redirect unauthenticated users to the sign-in page.
  • Role comes from Prisma User.role via getSession() / /api/v1/auth/me. Password verification is not a live path.

Role-Based access control implementation#

Role-based access is handled in:

  • Role stored on User.role. Access JWT sub is the user id. Session hydrates role from Postgres.
  • UI rendering: role displayed in user section and used to tailor quick actions.

Dynamic routing and nested routing patterns#

Dynamic and nested routing patterns include:

  • Dynamic route for resume analysis: [id] under /dashboard/analysis.
  • Nested dashboards: /dashboard/seeker is the resume workspace. /dashboard/recruiter is leftover chrome, not TalentSync-HR. /dashboard/admin is operator UI.
  • Nested route for PDF resume generation: /dashboard/pdf-resume.
  • [dashboard/analysis/[id]/page.tsx](file://frontend/app/dashboard/analysis/[id]/page.tsx#L56-L223)

  • dashboard/pdf-resume/page.tsx

  • [dashboard/analysis/[id]/page.tsx](file://frontend/app/dashboard/analysis/[id]/page.tsx#L56-L223)

  • dashboard/pdf-resume/page.tsx

Mobile-Responsive navigation patterns#

Mobile navigation integrates:

  • Bottom tab bar with active state tracking and a floating action button.
  • Tablet menu overlay with quick actions and user controls.
  • Responsive breakpoints: desktop sidebar, tablet overlay, mobile bottom bar.

User workflow flows#

Typical user workflows:

  • Unauthenticated user visits dashboard → redirected to sign-in.
  • Authenticated user lands on dashboard → quick actions and role-specific dashboards available.
  • Resume creation workflow: PDF Resume Generator → choose or upload → open workspace → export/edit.
  • [dashboard/analysis/[id]/page.tsx](file://frontend/app/dashboard/analysis/[id]/page.tsx#L56-L223)

  • [dashboard/analysis/[id]/page.tsx](file://frontend/app/dashboard/analysis/[id]/page.tsx#L56-L223)

Dependencies#

The navigation stack depends on:

  • Next.js App Router for file-system routing.
  • FastAPI cookies and session-provider.tsx for session and role.
  • Framer Motion for animations.
  • Lucide icons for visual affordances.
  • React Context for sidebar state.
  • [dashboard/analysis/[id]/page.tsx](file://frontend/app/dashboard/analysis/[id]/page.tsx#L56-L223)

  • [dashboard/analysis/[id]/page.tsx](file://frontend/app/dashboard/analysis/[id]/page.tsx#L56-L223)

Performance#

  • Client-side routing: Use Next.js automatic code splitting and route segments to minimize bundle sizes.
  • Navigation animations: Keep Framer Motion animations lightweight; avoid heavy transforms on frequently accessed routes.
  • Sidebar state: Persist collapsed state locally if needed to reduce re-computation across navigations.
  • Protected routes: Perform minimal checks on the client; rely on server-side session validation for sensitive operations.
  • Lazy loading: Consider lazy-loading heavy components within tabs (e.g., editor panels) to improve initial load performance.

Troubleshooting#

Common issues:

  • Unauthenticated redirect loops: Ensure client-side guards only redirect when status is unauthenticated and avoid infinite redirects by guarding against the auth route itself.
  • Role not reflected in UI: confirm User.role and call useSession().refresh() after /update-role.
  • Mobile bottom nav not highlighting active route: Verify active index computation matches pathname and that hrefs align with route segments.
  • Sidebar offset incorrect: Confirm LayoutContent applies correct padding based on sidebar collapse state.